package com.whfc.cncit.entity;

import com.google.common.base.Preconditions;
import com.whfc.cncit.constant.CncitConst;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Description:
 * @author: xugcheng
 * @version: 1.0
 * @date: 2019/10/24 17:03
 */
@Data
@NoArgsConstructor
public class CncitUpMsgR extends CncitUpMsg {

    @Override
    public String getCmd() {
        return CncitConst.UP_CMD_R;
    }

    public CncitUpMsgR(String deviceCode) {
        super();
        Preconditions.checkNotNull(deviceCode);
        this.deviceCode = deviceCode;
    }

    public int getDataLength() {
        //$08,R,0001,#
        return getCmd().length() + 1 + deviceCode.length() + 1 + 1;
    }
}
